<template>
	<view>
		<image class="logo" src="../../static/image/logo.png"></image>
		<button type="primary" @click="getUserInfo">授权登录</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			getUserInfo(){
				// console.log("获取用户信息方法")
				uni.getUserProfile({
					/* 下面这个desc是必填的字段 */
					desc: 'Wexin',
					success(res) {
						// console.log(res,"成功获取到用户信息")
						let userInfo = JSON.parse(res.rawData)
						uni.setStorageSync('userInfo', userInfo);
						
						uni.switchTab({
							url:"../index/index"
						})
					},
					fail: (err) => {
						console.log(err)
					}
					
				})
				
			}
		}
	}
</script>

<style lang="less">
	.logo{
		width:500rpx;
		text-align:center;
		margin-left: 125rpx;
		margin-top: 200rpx;
	}
</style>
